﻿using System;
using SlamDunk.CMS.Model.Base;
using SlamDunk.CMS.Model.ViewModel;

namespace SlamDunk.CMS.Model.DataModel
{
    /// <summary>
    /// 消息
    /// </summary>
    public class Message : BaseEntity
    {
        #region # 属性

        #region 标题 —— string Title
        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }
        #endregion

        #region 内容 —— string Content
        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; }
        #endregion

        #region 联系人姓名 —— string ContractName
        /// <summary>
        /// 联系人姓名
        /// </summary>
        public string ContractName { get; set; }
        #endregion

        #region 联系电话 —— string ContractPhone
        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContractPhone { get; set; }
        #endregion

        #region 联系QQ —— string ContractQQ
        /// <summary>
        /// 联系QQ
        /// </summary>
        public string ContractQQ { get; set; }
        #endregion

        #region 电子邮箱 —— string ContractEmail
        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string ContractEmail { get; set; }
        #endregion

        #region 回复 —— string Reply
        /// <summary>
        /// 回复
        /// </summary>
        public string Reply { get; set; }
        #endregion

        #region 回复时间 —— DateTime? ReplyTime
        /// <summary>
        /// 回复时间
        /// </summary>
        public DateTime? ReplyTime { get; set; }
        #endregion

        #endregion

        #region # 方法

        #region 转换为视图模型 —— MessageView ToViewModel()
        /// <summary>
        /// 转换为视图模型
        /// </summary>
        /// <returns>视图模型</returns>
        public MessageView ToViewModel()
        {
            return new MessageView()
            {
                Id = this.Id,
                Title = this.Title,
                Content = this.Content,
                ContractName = this.ContractName,
                ContractPhone = this.ContractPhone,
                ContractQQ = this.ContractQQ,
                ContractEmail = this.ContractEmail,
                AddTime = this.AddTime.ToString("yyyy-MM-dd HH:mm:ss"),
            };
        }
        #endregion

        #endregion
    }
}
